﻿<Controls:MetroWindow x:Class="Shoozla.View.ResultView"
        xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" 
        xmlns:datavis="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit"                       
        xmlns:chartingprimitives="clr-namespace:System.Windows.Controls.DataVisualization.Charting.Primitives;assembly=System.Windows.Controls.DataVisualization.Toolkit"  
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro" 
        xmlns:effect="clr-namespace:GrayscaleEffect;assembly=GrayscaleEffect"
        xmlns:s="clr-namespace:Shoozla"
        xmlns:sv="clr-namespace:Shoozla.View"
        xmlns:svm="clr-namespace:Shoozla.ViewModel"                  
        Title="Artworks" Height="450" Width="700" ShowWindowCommands="False" ShowInTaskbar="False" Topmost="False" WindowStartupLocation="CenterOwner" UseLayoutRounding="True" AllowsTransparency="False" ShowIconOnTitleBar="False" ShowTitleBar="False">
    <i:Interaction.Behaviors>
        <behaviours:BorderlessWindowBehavior ResizeWithGrip="False" AutoSizeToContent="False" />
    </i:Interaction.Behaviors>

    <DockPanel OpacityMask="{x:Null}">
        <WrapPanel VerticalAlignment="Center"  DockPanel.Dock="Bottom" HorizontalAlignment="Right">
            <Button x:Name="CloseBT" Content="Cancel" Command="{Binding Path=CmdClose}" ToolTip="Close this window" Height="23" Width="50" Margin="0,0,0,5">
            </Button>
            <Button x:Name="ApplyBT" Content="Apply" Command="{Binding Path=CmdApply}" ToolTip="Save all covers and apply to the files" Height="23" Width="50" Margin="5,0,5,5" IsDefault="True">
            </Button>
        </WrapPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="215" />
            </Grid.ColumnDefinitions>
            
            <TabControl Name="summaryTC" Grid.Column="0" SelectionChanged="summaryTC_SelectionChanged">
                <TabItem Header="Album" Name="albumTI">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Artworks found using the Album name" HorizontalAlignment="Left" FontStyle="Italic" Margin="5"/>
                        <ListView x:Name="albumLV" ItemsSource="{Binding Path=ThumbsAlbum}"  SelectionChanged="album_SelectionChanged" SelectionMode="Single" Height="290">
                            <!--<Style TargetType="{x:Type ListViewItem}">
                                
                            </Style>-->
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Width="25" CellTemplate="{DynamicResource checkboxCell}">
                                        <CheckBox IsThreeState="False" IsChecked="{Binding Path=AllAlbumSelected}"/>
                                    </GridViewColumn>
                                    <GridViewColumn Header="Album name" CellTemplate="{DynamicResource DisplayStringCell}" Width="420" />
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </StackPanel>
                </TabItem>
                <TabItem Header="Title" Name="songTI">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Artworks found using the Artist name + the song name" HorizontalAlignment="Left" FontStyle="Italic" Margin="5"/>
                    <ListView x:Name="songLV" ItemsSource="{Binding Path=ThumbsSong}" SelectionChanged="song_SelectionChanged" SelectionMode="Single" Height="290">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="25" CellTemplate="{DynamicResource checkboxCell}">
                                        <CheckBox IsThreeState="False" IsChecked="{Binding Path=AllSongSelected}"/>
                                </GridViewColumn>
                                    <GridViewColumn Header="Song title" CellTemplate="{DynamicResource DisplayStringCell}" Width="420" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                    </StackPanel>
                </TabItem>
                <TabItem Header="Artist" Name="artistTI">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Artworks found using only the Artist name" HorizontalAlignment="Left" FontStyle="Italic" Margin="5"/>
                        <ListView x:Name="artistLV" ItemsSource="{Binding Path=ThumbsArtist}"  SelectionChanged="artist_SelectionChanged" SelectionMode="Single" Height="290">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="25" CellTemplate="{DynamicResource checkboxCell}">
                                        <CheckBox IsThreeState="False" IsChecked="{Binding Path=AllArtistSelected}"/>
                                </GridViewColumn>
                                    <GridViewColumn Header="Artist name" CellTemplate="{DynamicResource DisplayStringCell}" Width="420" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                    </StackPanel>
                </TabItem>
                <TabItem Header="Not found" Name="notFoundTI">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Songs that Shoozla could not find" HorizontalAlignment="Left" FontStyle="Italic" Margin="5"/>
                        <ListView x:Name="notfoundLV" ItemsSource="{Binding Path=NotFoundMp3}" SelectionMode="Single" Height="265" VerticalAlignment="Top">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Header="Artist" CellTemplate="{DynamicResource ArtistCell}" Width="100" />
                                    <GridViewColumn Header="Title" CellTemplate="{DynamicResource TitleCell}" Width="100" />
                                    <GridViewColumn Header="Album" CellTemplate="{DynamicResource AlbumCell}" Width="100" />
                                    <GridViewColumn Header="Filename" CellTemplate="{DynamicResource FileNameCell}" Width="145" />
                                </GridView>
                            </ListView.View>
                        </ListView>
                        <Button Content="Save list" Height="23" HorizontalAlignment="Right" Name="saveListBT" VerticalAlignment="Top" Width="70" Command="{Binding Path=SaveListCmd}" ToolTip="Create a text file with this list" />
                    </StackPanel>
                  
                </TabItem>
            </TabControl>
            
            <!--<TextBlock  Margin="5" Text="Artworks found" Foreground="{DynamicResource AccentColorBrush}" FontSize="50" Grid.Column="0" Grid.Row="0" />-->
            
            <StackPanel Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Name="previewPN" >
                <charting:Chart x:Name="splittedChart"  Height="200" Width="200" BorderThickness="0" Visibility="{Binding ShowCharts, Converter={StaticResource boolToVis}}" >
                    <charting:Chart.Template>
                        <ControlTemplate TargetType="charting:Chart">
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" >
                                    <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" Background="White" />
                                    <Border Canvas.ZIndex="10" BorderThickness="0" />
                                </chartingprimitives:EdgePanel>
                            </Border>
                        </ControlTemplate>
                    </charting:Chart.Template>
                    <charting:Chart.Series>
                        <charting:ColumnSeries DependentValueBinding="{Binding Path=Value}" IndependentValueBinding="{Binding Path=Key}" AnimationSequence="Simultaneous" >                          
                        </charting:ColumnSeries>
                    </charting:Chart.Series>
                    <charting:Chart.Palette>
                        <datavis:ResourceDictionaryCollection>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="{DynamicResource AccentColorBrush}"/>
                                </Style>
                            </ResourceDictionary>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="#4D10DA"/>
                                </Style>
                            </ResourceDictionary>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="#89D5FA"/>
                                </Style>
                            </ResourceDictionary>
                            <ResourceDictionary>
                                <Style x:Key="DataPointStyle" TargetType="Control">
                                    <Setter Property="Background" Value="#05577F"/>
                                </Style>
                            </ResourceDictionary>
                        </datavis:ResourceDictionaryCollection>
                    </charting:Chart.Palette>
                </charting:Chart>
                <TextBlock x:Name="chartTitle"  Text="Artowrks found (%)" Foreground="{DynamicResource AccentColorBrush}" FontStyle="Italic" HorizontalAlignment="Center"  Visibility="{Binding ShowCharts, Converter={StaticResource boolToVis}}"   />
                <charting:Chart x:Name="summaryChart"  Height="200" Width="200" BorderThickness="0" Visibility="{Binding ShowCharts, Converter={StaticResource boolToVis}}" >
                    <charting:Chart.Template>
                        <ControlTemplate TargetType="charting:Chart">
                            <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">                               
                                <chartingprimitives:EdgePanel x:Name="ChartArea" Style="{TemplateBinding ChartAreaStyle}" >
                                    <Grid Canvas.ZIndex="-1" Style="{TemplateBinding PlotAreaStyle}" Background="White" />
                                    <Border Canvas.ZIndex="10" BorderThickness="0" />
                                </chartingprimitives:EdgePanel>                                                                    
                            </Border>
                        </ControlTemplate>
                    </charting:Chart.Template>
                    <charting:Chart.Series>
                        <charting:PieSeries DependentValueBinding="{Binding Path=Value}" IndependentValueBinding="{Binding Path=Key}" AnimationSequence="Simultaneous" >
                            <charting:PieSeries.Palette>
                                <datavis:ResourceDictionaryCollection>
                                    <ResourceDictionary>
                                        <Style x:Key="DataPointStyle" TargetType="Control">
                                            <Setter Property="Background" Value="{DynamicResource AccentColorBrush}"/>                                            
                                        </Style>
                                    </ResourceDictionary>
                                    <ResourceDictionary>
                                        <Style x:Key="DataPointStyle" TargetType="Control">
                                            <Setter Property="Background" Value="#05577F"/>                                           
                                        </Style>
                                    </ResourceDictionary>
                                    <ResourceDictionary>
                                        <Style x:Key="DataPointStyle" TargetType="Control">
                                            <Setter Property="Background" Value="#89D5FA"/>                                            
                                        </Style>
                                    </ResourceDictionary>
                                    <ResourceDictionary>
                                        <Style x:Key="DataPointStyle" TargetType="Control">
                                            <Setter Property="Background" Value="#4D10DA"/>                                            
                                        </Style>
                                    </ResourceDictionary>
                                </datavis:ResourceDictionaryCollection>
                            </charting:PieSeries.Palette>
                        </charting:PieSeries>
                    </charting:Chart.Series>
                </charting:Chart>
                <Image Name="currentCover"  Stretch="Fill"  Height="200" Width="200" Source="{Binding CurrentCover}"  Visibility="{Binding ShowCover, Converter={StaticResource boolToVis}}" >
                    <Image.BitmapEffect>
                        <DropShadowBitmapEffect Color="Black" Direction="320" ShadowDepth="20" Softness="2" Opacity="0.5"/>
                    </Image.BitmapEffect>
                </Image>
            </StackPanel>
        </Grid>
        
    </DockPanel>
  
 
</Controls:MetroWindow>
